Skip to content

Add edit dialog for managed agents with relay profile sync#277

Merged
wpfleger96 merged 4 commits intomainfrom
sprout-ux/edit-agents
Apr 13, 2026
Merged

Add edit dialog for managed agents with relay profile sync#277
wpfleger96 merged 4 commits intomainfrom
sprout-ux/edit-agents

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

@wpfleger96 wpfleger96 commented Apr 8, 2026

This PR adds an Edit dialog for managed agents so configuration changes don't require delete-and-recreate, and syncs name changes to the relay so they're visible in @mentions, DMs, and member lists.

UpdateManagedAgentRequest only patched model and system_prompt. Name, parallelism, relay URL, agent command, MCP command, turn timeout, and toolsets were write-once at creation time. Renaming an agent updated the local record but never re-published the relay profile, making name changes invisible to other users.

  • Extend UpdateManagedAgentRequest in types.rs with editable fields for all runtime config (parallelism, relay URL, commands, toolsets) using patch semantics
  • Make update_managed_agent async; call sync_managed_agent_profile() to re-publish the kind:0 event when the name changes (best-effort — local save always succeeds, relay sync failure is logged and returned as a non-fatal warning)
  • Add useUpdateManagedAgentMutation hook with optimistic cache update and invalidation on managed-agents and relay-agents queries
  • Add EditAgentDialog.tsx reusing CreateAgentBasicsFields and CreateAgentRuntimeFields pre-populated with current values; diffs on submit to send only changed fields; includes mcpToolsets field from Add per-agent MCP toolset configuration to agent setup #279
  • Wire an "Edit" DropdownMenuItem with a Pencil icon into AgentActionsMenu in ManagedAgentRow.tsx (hidden for provider-backed agents)
  • Validate numeric fields (parallelism, turnTimeoutSeconds) and block clearing previously-set acpCommand/mcpCommand to empty strings

@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 I have some agent catalog stuff in flight here, so it might change the behavior of this. Let's check things again after that merges to see where we can improve.

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

@wesbillman np happy to wait until that's ready!

@wesbillman
Copy link
Copy Markdown
Collaborator

wesbillman commented Apr 9, 2026

@wpfleger96 excellent, the start of the catalog is in there now so feel free to take a look. Might not impact this work too much.

Oh also, it's nice if you can drop an image or 2 in here (or a video) to see what this feature does for the reviewers

@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch 4 times, most recently from a64f253 to afaed41 Compare April 10, 2026 16:47
@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 is the #288 work similar to yours here?

@tellaho
Copy link
Copy Markdown
Collaborator

tellaho commented Apr 10, 2026

@wpfleger96 is the #288 work similar to yours here?

Think they are adjacent, but not overlapping. #288 is mostly for importing against "my" teams and agents.

@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch 2 times, most recently from e6c391c to bd01f8f Compare April 10, 2026 17:57
@wpfleger96 wpfleger96 changed the title Add edit dialog for managed agents Add edit dialog for managed agents with relay profile sync Apr 10, 2026
@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch from a365ffa to 1fae620 Compare April 10, 2026 18:15
@wpfleger96
Copy link
Copy Markdown
Collaborator Author

new Edit menu for managed agents:
image
image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

Renaming a managed agent (or updating avatar) now syncs to the relay after save without having to delete/recreate teh agent:
image

image

(didn't need to restart Sprout or delete/recreate agent here)

image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

wpfleger96 commented Apr 10, 2026

edits are validated before saving (typing asdf in Turn timeout grays out Save changes button until I fix it):

image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

@wesbillman mind giving this another look if you get the chance? 😄

Once a managed agent was created, there was no way to change its
configuration — system prompt, parallelism, relay URL, commands,
timeouts, and name — without deleting and recreating it from scratch.

Extends UpdateManagedAgentRequest on the Rust side to accept all
editable fields with patch semantics (absent = don't touch), updates
the update_managed_agent command handler to apply them, and mirrors
the extended type on the frontend. Adds a useUpdateManagedAgentMutation
hook following the existing mutation pattern, creates EditAgentDialog
that reuses the CreateAgentDialogSections form components pre-populated
with the agent's current values, and wires an "Edit" item into the
AgentActionsMenu dropdown.
useEffect deps included non-stable references (agent object, args
array), causing form state to reset on every 5s background poll
while the user was editing. Pin deps to [open, agent.pubkey].

Also: validate numeric fields in canSubmit, trim relayUrl before
diff, hide Edit for provider-backed agents, and block empty
acpCommand/mcpCommand submission.
update_managed_agent was fire-and-forget for name changes — the local
record updated but the relay's kind:0 profile event was never
re-published, making renames invisible in @mentions, DMs, and member
lists. Reuses the existing sync_managed_agent_profile() path from
agent creation to re-publish the kind:0 event when the name changes.
@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch from 1fae620 to 77fec21 Compare April 13, 2026 17:30
@wesbillman
Copy link
Copy Markdown
Collaborator

@codex review please

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77fec21304

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 I think we can probably merge this thing now if you're good with it

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

@wesbillman thank you! I'll address those Codex review comments rq then merge

…, e2e bridge

Three issues caught by Codex bot review:

1. UpdateManagedAgentResponse had #[serde(rename_all = "camelCase")] but
   CreateManagedAgentResponse does not — frontend read profile_sync_error
   (snake_case) which was always undefined since the wire format was camelCase.
   Removed the rename attribute to match the existing pattern.

2. update_managed_agent persisted blank relay URLs as empty strings instead
   of falling back to relay_ws_url() like create_managed_agent does. Would
   break SPROUT_RELAY_URL on next agent spawn.

3. e2e bridge's handleUpdateManagedAgent returned a raw RawManagedAgent
   instead of the wrapped { agent, profile_sync_error } shape, causing
   fromRawManagedAgent(undefined) in test mode.
@wpfleger96 wpfleger96 enabled auto-merge (squash) April 13, 2026 18:07
@wesbillman
Copy link
Copy Markdown
Collaborator

Awesome! Thanks for doing this @wpfleger96!

@wpfleger96 wpfleger96 merged commit ccecf7e into main Apr 13, 2026
10 checks passed
@wpfleger96 wpfleger96 deleted the sprout-ux/edit-agents branch April 13, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants